package com.hushao.aimi.config.exception;

import com.hushao.aimi.common.ResponseCode;
import com.hushao.aimi.common.ServerResponse;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @description: 统一异常处理
 * @author: 胡少
 * @create: 2018-06-03 23:27
 **/
@RestControllerAdvice
public class ExceptionHanderAdvice {
    @ExceptionHandler(Exception.class)
    public ServerResponse handleException(Exception e){
        return ServerResponse.Error(ResponseCode.INTERNAL_SERVER_ERROR.getCode(),e.getMessage());
    }
}
